/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.financial.entity.arrivalreminder;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.modules.base.entity.customer.Customer;
import com.jeesite.modules.base.entity.supplier.Supplier;
import com.jeesite.modules.financial.entity.lettercredit.LetterCredit;
import com.jeesite.modules.logistics.entity.ladingbill.LadingBill;
import com.jeesite.modules.order.entity.serviceorder.ServiceOrder;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotNull;
import java.util.Date;

/**
 * 到单提醒Entity
 *
 * @author LV
 * @version 2021-03-04
 */
@Table(name = "t_arrival_reminder", alias = "a", columns = {
        @Column(name = "arrival_reminder_id", attrName = "arrivalReminderId", label = "到单提醒ID", isPK = true),
        @Column(name = "arrival_reminder_code", attrName = "arrivalReminderCode", label = "单据编号", queryType = QueryType.LIKE),
        @Column(name = "service_order_id", attrName = "serviceOrderId", label = "服务订单"),
        @Column(name = "customer_id", attrName = "customerId", label = "客户名称"),
        @Column(name = "investor_id", attrName = "investorId", label = "国内资方"),
        @Column(name = "foreign_businessmen_id", attrName = "foreignBusinessmenId", label = "外商名称"),
        @Column(name = "supplier_id", attrName = "supplierId", label = "供货外商"),
        @Column(name = "lading_bill_code", attrName = "ladingBillCode", label = "提单号"),
        @Column(name = "letter_credit_code", attrName = "letterCreditCode", label = "信用证号"),
        @Column(name = "not_arrived_qty", attrName = "notArrivedQty", label = "未到单数量"),
        @Column(name = "foreign_trade_contract", attrName = "foreignTradeContract", label = "外贸合同"),
        @Column(name = "arrived_qty", attrName = "arrivedQty", label = "已到单数量"),
        @Column(name = "remarks", attrName = "remarks", label = "备注信息"),
        @Column(name = "create_by", attrName = "createBy", label = "创建者", isUpdate = false),
        @Column(name = "create_date", attrName = "createDate", label = "创建时间"),
        @Column(name = "update_by", attrName = "updateBy", label = "更新者"),
        @Column(name = "update_date", attrName = "updateDate", label = "更新时间"),
}, joinTable = {
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = Supplier.class, attrName = "invSupplier", alias = "b",
                on = "b.supplier_id = a.investor_id",
                columns = {
                        @Column(name = "supplier_id", label = "供应商编号", isPK = true),
                        @Column(name = "supplier_name", label = "供应商名称"),
                }),
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = Supplier.class, attrName = "forSupplier", alias = "c",
                on = "c.supplier_id = a.foreign_businessmen_id",
                columns = {
                        @Column(name = "supplier_id", label = "供应商编号", isPK = true),
                        @Column(name = "supplier_name", label = "供应商名称"),
                }),
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = Supplier.class, attrName = "supplier", alias = "d",
                on = "d.supplier_id = a.supplier_id",
                columns = {
                        @Column(name = "supplier_id", label = "供应商编号", isPK = true),
                        @Column(name = "supplier_name", label = "供应商名称"),
                }),
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = Customer.class, attrName = "customer", alias = "e",
                on = "e.customer_id = a.customer_id",
                columns = {
                        @Column(name = "customer_id", label = "客户编号", isPK = true),
                        @Column(name = "customer_name", label = "客户名称"),
                }),
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = LadingBill.class, attrName = "ladingBill", alias = "f",
                on = "f.lading_bill_id = a.lading_bill_code",
                columns = {
                        @Column(name = "lading_bill_id", label = "提单ID", isPK = true),
                        @Column(name = "lading_bill_code", label = "提单编号"),
                }),
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = LetterCredit.class, attrName = "letterCredit", alias = "g",
                on = "g.letter_credit_id = a.letter_credit_code",
                columns = {
                        @Column(name = "letter_credit_id", label = "信用证ID", isPK = true),
                        @Column(name = "letter_credit_code", label = "信用证编号"),
                }),
        @JoinTable(type = JoinTable.Type.LEFT_JOIN, entity = ServiceOrder.class, attrName = "serviceOrder", alias = "s",
                on = "s.service_order_id = a.service_order_id",
                columns = {
                        @Column(name = "service_order_id", label = "服务订单ID", isPK = true),
                        @Column(name = "service_order_code", label = "服务订单编号"),
                }),
}, orderBy = "a.update_date DESC"
)
public class ArrivalReminder extends DataEntity<ArrivalReminder> {

    private static final long serialVersionUID = 1L;
    private String arrivalReminderId;        // 到单提醒ID
    private String arrivalReminderCode;        // 单据编号
    private String serviceOrderId;        // 服务订单
    private ServiceOrder serviceOrder;        // 服务订单
    private String customerId;        // 客户名称
    private String investorId;        // 国内资方
    private String foreignBusinessmenId;    // 外商名称
    private String supplierId;        // 供货外商
    private String ladingBillCode;        // 提单号
    private LadingBill ladingBill;
    private String letterCreditCode;        // 信用证号
    private LetterCredit letterCredit;
    private Long notArrivedQty;        // 未到单数量
    private String foreignTradeContract;        // 外贸合同
    private Long arrivedQty;        // 已到单数量
    private Supplier invSupplier;
    private Supplier forSupplier;
    private Supplier supplier;
    private Customer customer;

    public ArrivalReminder() {
        this(null);
    }

    public ArrivalReminder(String id) {
        super(id);
    }

    public String getArrivalReminderId() {
        return arrivalReminderId;
    }

    public void setArrivalReminderId(String arrivalReminderId) {
        this.arrivalReminderId = arrivalReminderId;
    }

    @Length(min = 0, max = 100, message = "单据编号长度不能超过 100 个字符")
    public String getArrivalReminderCode() {
        return arrivalReminderCode;
    }

    public void setArrivalReminderCode(String arrivalReminderCode) {
        this.arrivalReminderCode = arrivalReminderCode;
    }

    @Length(min = 0, max = 64, message = "服务订单长度不能超过 64 个字符")
    public String getServiceOrderId() {
        return serviceOrderId;
    }

    public void setServiceOrderId(String serviceOrderId) {
        this.serviceOrderId = serviceOrderId;
    }

    @Length(min = 0, max = 64, message = "客户名称长度不能超过 64 个字符")
    public String getCustomerId() {
        return customerId;
    }

    public void setCustomerId(String customerId) {
        this.customerId = customerId;
    }

    @Length(min = 0, max = 64, message = "外商名称长度不能超过 64 个字符")
    public String getForeignBusinessmenId() {
        return foreignBusinessmenId;
    }

    public void setForeignBusinessmenId(String foreignBusinessmenId) {
        this.foreignBusinessmenId = foreignBusinessmenId;
    }

    @Length(min = 0, max = 64, message = "供货外商长度不能超过 64 个字符")
    public String getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(String supplierId) {
        this.supplierId = supplierId;
    }

    @Length(min = 0, max = 64, message = "国内资方长度不能超过 64 个字符")
    public String getInvestorId() {
        return investorId;
    }

    public void setInvestorId(String investorId) {
        this.investorId = investorId;
    }

    @Length(min = 0, max = 100, message = "提单号长度不能超过 100 个字符")
    public String getLadingBillCode() {
        return ladingBillCode;
    }

    public void setLadingBillCode(String ladingBillCode) {
        this.ladingBillCode = ladingBillCode;
    }

    @Length(min = 0, max = 100, message = "信用证号长度不能超过 100 个字符")
    public String getLetterCreditCode() {
        return letterCreditCode;
    }

    public void setLetterCreditCode(String letterCreditCode) {
        this.letterCreditCode = letterCreditCode;
    }

    public Long getNotArrivedQty() {
        return notArrivedQty;
    }

    public void setNotArrivedQty(Long notArrivedQty) {
        this.notArrivedQty = notArrivedQty;
    }

    @Length(min = 0, max = 100, message = "外贸合同长度不能超过 100 个字符")
    public String getForeignTradeContract() {
        return foreignTradeContract;
    }

    public void setForeignTradeContract(String foreignTradeContract) {
        this.foreignTradeContract = foreignTradeContract;
    }

    @NotNull(message = "已到单数量不能为空")
    public Long getArrivedQty() {
        return arrivedQty;
    }

    public void setArrivedQty(Long arrivedQty) {
        this.arrivedQty = arrivedQty;
    }

    public Date getCreateDate_gte() {
        return sqlMap.getWhere().getValue("create_date", QueryType.GTE);
    }

    public void setCreateDate_gte(Date createDate) {
        sqlMap.getWhere().and("create_date", QueryType.GTE, createDate);
    }

    public Date getCreateDate_lte() {
        return sqlMap.getWhere().getValue("create_date", QueryType.LTE);
    }

    public void setCreateDate_lte(Date createDate) {
        sqlMap.getWhere().and("create_date", QueryType.LTE, createDate);
    }

    public Date getUpdateDate_gte() {
        return sqlMap.getWhere().getValue("update_date", QueryType.GTE);
    }

    public void setUpdateDate_gte(Date updateDate) {
        sqlMap.getWhere().and("update_date", QueryType.GTE, updateDate);
    }

    public Date getUpdateDate_lte() {
        return sqlMap.getWhere().getValue("update_date", QueryType.LTE);
    }

    public void setUpdateDate_lte(Date updateDate) {
        sqlMap.getWhere().and("update_date", QueryType.LTE, updateDate);
    }

    public Supplier getSupplier() {
        return supplier;
    }

    public void setSupplier(Supplier supplier) {
        this.supplier = supplier;
    }

    public Supplier getInvSupplier() {
        return invSupplier;
    }

    public void setInvSupplier(Supplier invSupplier) {
        this.invSupplier = invSupplier;
    }

    public Supplier getForSupplier() {
        return forSupplier;
    }

    public void setForSupplier(Supplier forSupplier) {
        this.forSupplier = forSupplier;
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public ServiceOrder getServiceOrder() {
        return serviceOrder;
    }

    public void setServiceOrder(ServiceOrder serviceOrder) {
        this.serviceOrder = serviceOrder;
    }

    public LadingBill getLadingBill() {
        return ladingBill;
    }

    public void setLadingBill(LadingBill ladingBill) {
        this.ladingBill = ladingBill;
    }

    public LetterCredit getLetterCredit() {
        return letterCredit;
    }

    public void setLetterCredit(LetterCredit letterCredit) {
        this.letterCredit = letterCredit;
    }
}